@extends('admin::layouts.master')
@section('title')
    编辑权益
@endsection
@section('tab')
		<div class="layui-fluid">
            <div class="layui-row">
                <form class="layui-form" >
                	{{csrf_field()}}
                    {{hi_form_hidden('id',$info->id)}}
                    <div class="layui-form-item">
                        <label for="username" class="layui-form-label">
                            <span class="x-red">*</span>权益名称</label>
                        <div class="layui-input-inline" style="width: 300px;">
                            <input type="text" name="name" lay-verify="required" value="{{$info->name}}" autocomplete="off" class="layui-input"></div>
                    </div>

                    <div class="layui-form-item">
                        <label for="L_alias" class="layui-form-label">
                            <span class="x-red">*</span>权益logo</label>
                        <div class="layui-input-inline">
                            @if($info['img'])
                                <img class="layui-upload-img upload_img" src="{{$info['img']}}" height="100" width="150">
                            @else
                                <img class="layui-upload-img upload_img" src="admin/images/bg.png" height="100" width="150">
                            @endif
                            <input type="hidden" name="img" value="" lay-verify="pic_log" id="img_url">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="username" class="layui-form-label">
                            <span class="x-red">*</span>排序</label>
                        <div class="layui-input-inline" style="width: 300px;">
                            <input type="text" name="sort" lay-verify="required" value="{{$info->sort}}" autocomplete="off" class="layui-input"></div>
                    </div>

                    <div class="layui-form-item">
                        <label for="username" class="layui-form-label">
                            <span class="x-red">*</span>备注、说明</label>
                        <div class="layui-input-inline" style="width: 300px;">
                            <textarea placeholder="请输入内容" id="desc" lay-verify="required" name="remark" class="layui-textarea">{{$info->remark}}</textarea>
                        </div>
                    </div>

			        <div class="layui-form-item">
			            <label for="L_repass" class="layui-form-label"></label>
			            <button class="layui-btn" lay-filter="edit" lay-submit="">确认</button>
			        </div>
        		</form>
        	</div>
        </div>

@endsection

@section('tab_js')
    <script>

        layui.use(['form', 'layer', 'jquery'], function () {
            $ = layui.jquery;
            var form = layui.form,
                layer = layui.layer;

            //监听提交
            form.on('submit(edit)', function (data) {
                $.ajax({
                    url: js_url('admin-grade-update_equities'),
                    type: 'post',
                    data: data.field,
                    dataType: "json",
                    success: function (result) {
                        if (result.state === 0) {
                            layer.msg("增加成功", {time: 500, icon: 6}, function () {
                                //关闭当前frame
                                xadmin.close();
                                // 可以对父窗口进行刷新
                                xadmin.father_reload();
                            });
                        } else {
                            layer.msg(result.msg, {time: 500, icon: 5});
                        }
                    }
                });
                return false;

            });


        });
    </script>
@endsection